FileUploader = require "./../../../common/file-uploader/index.coffee"

$ () ->
    imgKeyValue1 = null

    new FileUploader {
        click_button: "upload1_btn", # 点击后触发打开上传文件窗口的按钮，与类型为file的按钮绑定
        show_img: "cn_img1",                   # 上传成功后回显的图片ID
        domain: "http://ozjihfhke.bkt.clouddn.com",    # bucket 域名，下载资源时用到，**必需**
        browse_button: 'upload1',       # 上传选择的点选按钮ID，**必需**
        container: 'img-wrapper1',       # 上传区域DOM ID，默认是browser_button的父元素，**必需**
    }, {
        FileUploaded: (up, file, info)->
            imgKeyValue1 = info.key
    }

    $(".create_btn").click (e) ->
        # alert $("#section_value").val()
        param =
            wechat_doctor_id: $("#id").val()
            name: $("#name").val()
            job_title: $("#job_title").val()
            dr_type: $("#dr_type").val()
            resume: $("#resume").val()
            hospital: $("#hospital").val()
            section: $("#section_value").val()
            headimg: imgKeyValue1

        $.post "/api/admin/doctor/create",param,(res) ->
            if res.status.errCode is 0
                alert "认证成功"
            else
                alert res.status.message
